﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<ThietBiSo.LinQDB.Banner>" %>

<%@ Import Namespace="ThietBiSo.LinQDB" %>
<%@ Import Namespace="ThietBiSo.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Website - bảng điều khiển
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%
        Banner qc = (Banner)ViewData["banners"];
    %>
    <script type="text/javascript">
        function submitForm() {
            var F = document.forms[0];

            document.forms[0].submit();
        } 
    </script>
    <%
   
        MQuangCao mqc = new MQuangCao();
        var loaiqc = mqc.FindAll_LoaiQuangCao();
    %>
    <% using (Html.BeginForm("Edit", "banner", FormMethod.Post, new { @enctype = "multipart/form-data" }))
       { %>
    <%: Html.ValidationSummary(true) %>
    <fieldset>
        <legend class="classFieldSet">Sửa banner</legend>
        <table width="100%">
            <tr>
                <td class="classCreate">
                    <input type="button" value="Lưu" class="btn" onclick="submitForm();" />
                </td>
                <td class="classBack">
                    <%: Html.ActionLink("Quay lại", "Index",null,new { @class = "classThem" })%>
                </td>
            </tr>
            <tr>
                <td class="tableLabel">
                    <% if (qc.MaLoaiQuangCao == 1)
                       { %>
                    Hình ảnh
                    <%}
                       else if (qc.MaLoaiQuangCao == 2)
                       { %>
                    FLash
                    <%} %>
                </td>
                <td class="">
                    <%: Html.Hidden("HiddenHinhAnh",qc.UrlHinh)%>
                    <table width="100%">
                        <tr>
                            <td>
                                <%:Html.TextBox("HinhAnh", qc.UrlHinh)%>
                                <input type="button" value="Chọn ..." id="btnSelectImg" name="btnSelectImg" />
                                <script type="text/javascript">
                                    $(document).ready(function () {
                                        $("#btnSelectImg").click(function () {
                                            var finder = new CKFinder();
                                            finder.selectActionFunction = function (fileUrl) {
                                                $('#HinhAnh').val(fileUrl);
                                            };
                                            finder.popup();
                                        });
                                    });
                                </script>
                            </td>
                            <td>
                                <% if (qc.MaLoaiQuangCao == 1)
                                   { %>
                                <% if (qc.UrlHinh == "" || qc.UrlHinh == null || qc.UrlHinh == "noImage")
                                   { %>
                                <img src="<%:Url.Content("~/Content/images/nophoto.gif")%>" alt="" width="150px;"
                                    height="150px;" />
                                <%} %>
                                <img src="<%: qc.UrlHinh%>" alt="" width="150px" height="150px" />
                                <%}
                                   else if (qc.MaLoaiQuangCao == 2)
                                   { %>
                                <object width="200" height="250" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                                    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
                                    style="z-index: -1" id="Object1">
                                    <param name="movie" value="<%:qc.UrlHinh%>" />
                                    <param name="quality" value="high" />
                                    <param value="transparent" name="wmode" />
                                    <embed width="200" height="250" src="<%:qc.UrlHinh%>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"
                                        type="application/x-shockwave-flash" bgcolor="" wmode="transparent" id="flashfirebug_1355627846136"
                                        name="flashfirebug_1355627846136" allowscriptaccess="always" allowfullscreen="true"
                                        allownetworking="all"></embed>
                                    <param name="allowFullScreen" value="true" />
                                    <param name="allowScriptAccess" value="always" />
                                    <param name="AllowNetworking" value="all" />
                                </object>
                                <%} %>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="tableLabel">
                    Loại banner
                </td>
                <td class="tableField">
                    <%: Html.DropDownList("ddlLoai", new SelectList(loaiqc, "MaLoaiQuangCao", "TenLoaiQuangCao", qc.MaLoaiQuangCao), "Chọn loại", new { @style = "width:40px" })%>
                </td>
                <td style="color: Red">
                    Image: 1000 x auto
                    <br />
                    Flash: 1000 x 125
                </td>
            </tr>
        </table>
    </fieldset>
    <% } %>
</asp:Content>
